package cn.aigoubuy.dao;

import cn.aigoubuy.domain.User;

import java.sql.SQLException;

/**
* 用户模块的DAO层接口
*/
public interface UserDao {
    /**
     * 保存用户
     * @param user
     * @throws SQLException
     */
    void save(User user) throws SQLException;

    /**
     * 通过用户名和密码查找
     * @param username
     * @param password
     * @return
     * @throws SQLException
     */
    User find(String username, String password) throws SQLException;

    /**
     * 通过激活码查询用户
     * @param code
     * @return
     * @throws SQLException
     */
    User findByCode(String code) throws SQLException;
    /**
     * 更新用户信息
     * @param user
     */
    void updateUser(User user) throws SQLException;

    /**
     * 通过用户名查询用户
     * @param username
     * @return
     */
    User findByUsername(String username) throws SQLException;
}